﻿using System;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Windows;
using System.Windows.Controls;

namespace DaveSexton.Labs
{
	public abstract partial class PhoneLab : UserControl, ILab
	{
		#region Public Properties
		public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(string), typeof(PhoneLab), new PropertyMetadata(null));
		public static readonly DependencyProperty FullCategoryProperty = DependencyProperty.Register("FullCategory", typeof(string), typeof(PhoneLab), new PropertyMetadata(null));
		public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(PhoneLab), new PropertyMetadata(null));
		#endregion

		#region Private / Protected
		#endregion

		#region Constructors
		protected PhoneLab()
			: this(traceHeader: true)
		{
			Contract.Ensures(!HasProxy);
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="PhoneLab" /> class for derived classes.
		/// </summary>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors",
			Justification = "IsLabEnabled calls the ObjectInvariant method, which is flagged internally by CC so that it doesn't execute yet.")]
		protected PhoneLab(bool traceHeader)
		{
			Contract.Ensures(!HasProxy);

			listener = new Lazy<TraceListener>(CreateListener);

			this.shouldTraceHeader = traceHeader;

			Loaded += GUILab_Loaded;

			Contract.Assume(!HasProxy);
		}
		#endregion

		#region Methods
		#endregion
	}
}